#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=(2e5+1000)*2;
typedef int LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL a[maxn];
struct Tree{
    LL l,r,minval,tag;
}tree[maxn*4];
void push_up(LL p){
    tree[p].minval=min(tree[p*2].minval,tree[p*2+1].minval);
}
void push_down(LL p){
    if(tree[p].tag!=0){
        tree[p*2].minval+=tree[p].tag;
        tree[p*2+1].minval+=tree[p].tag;
        tree[p*2].tag+=tree[p].tag;
        tree[p*2+1].tag+=tree[p].tag;
        tree[p].tag=0;
    }
}
void addtag(LL p,LL d){
    tree[p].minval+=d;
    tree[p].tag+=d;
}
void build(LL p,LL l,LL r){
    tree[p].l=l;tree[p].r=r;tree[p].tag=0;tree[p].minval=0;
    if(l==r){tree[p].minval=0;return;}
    LL mid=(l+r)>>1;
    build(p*2,l,mid);
    build(p*2+1,mid+1,r);
    push_up(p);
}
void modify(LL p,LL l,LL r,LL d){
    if(l<=tree[p].l&&r>=tree[p].r){
        addtag(p,d);
        return;
    }
    push_down(p);
    LL mid=(tree[p].l+tree[p].r)>>1;
    if(l<=mid) modify(p*2,l,r,d);
    if(r>mid) modify(p*2+1,l,r,d);
    push_up(p);
}
LL query(LL p,LL l,LL r){
    return tree[p].minval;
}
int main(void)
{
  ///cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;t=read();
  while(t--){
    LL n,k;n=read();k=read();
    for(LL i=1;i<=n;i++) a[i]=read();
    build(1,1,2*k);

    for(LL i=1;i<=n/2;i++){
        modify(1,1,2*k,2);
        modify(1,min(a[i],a[n-i+1])+1,max(a[i],a[n-i+1])+k,-1);
        modify(1,a[i]+a[n-i+1],a[i]+a[n-i+1],-1);
    }
    LL ans=query(1,1,2*k);
  ///  debug(ans);
    cout<<max(ans,(LL)0)<<"\n";
  }
return 0;
}
